<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.Calendar"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/icon.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/style.css"/>">

<script type="text/javascript" src="<c:url value="/js/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/easyui-lang-zh_CN.js"/>"></script>
</head>
<body>
<script type="text/javascript">
	 $(function(){
		//表格双击 获取查询的值
		$('#cy_gh_mztf').datagrid({
			onDblClickRow:function(rowIndex,rowData){
				$("#ghNotf").textbox('setValue',rowData.ghNo);
				$("#dzcfNotf").textbox('setValue',rowData.dzcfNo);
				$("#brNametf").textbox('setValue',rowData.brName);
				$("#cfkyMoneytf").textbox('setValue',rowData.cfkyMoney);
				
				$("<form>").form('submit', {
					url : 'cyhisOutpatientchargeId',
					onSubmit : function(p) {
						p.ghNo=rowData.ghNo
					},
					success : function(data) {
						var json = eval("(" + data + ")");
						 $('#dzbl_ghmztf').datagrid('appendRow', {
								'cfkyType' : json.cfkyType,
								'cfkyMoney' : json.cfkyMoney,
								'cfkyState' : json.cfkyState,
								'cfkyNo' : json.cfkyNo
							});
						 $('#dzbl_ghmztf').datagrid('appendRow', {
								'cfkyType' : json.sfjlType,
								'cfkyMoney' : json.sfxmMoney,
								'cfkyState' : json.sfxmState,
								'cfkyNo' : json.sfxmNo
							});
					}
				});
				$("#cy-win-ghmzghtf").window("close");
		    }
		});
		
		//批量删除挂号信息
		$("#cy_icon-mztfco").linkbutton({
			onClick : function() {
				$.messager.confirm("提示", "确定要删除吗？", function(v) {
					if (v) {
						//获取所有选中的编号
						var rows = $("#cy_gh_mztf").datagrid("getSelections");
						//将编号保存到数组中
						var arr = [];
						for (var i = 0; i < rows.length; i++) {
							arr.push(rows[i].ghNo);
						}
						//用form提交
						$('<form>').form('submit', {
							url : 'cydeleteChooseRegister',
							onSubmit : function(param) {
								param.list = arr;
							},
							success : function(data) {
								var json = eval("(" + data + ")");
								$.messager.alert("提示", json.reason);
								$("#cy_gh_mztf").datagrid("reload");
							}
						});
					}
				});
			}
		});
		
		//改变行内样式
		$('#cy_gh_mztf').datagrid({
			rowStyler : function(index, row) {
				var endtime = new Date();
				var year = endtime.getYear() + 1900;
				var mouth = endtime.getMonth() + 1;
				if (mouth < 10) {
					mouth = "0" + mouth;
				}
				var day = endtime.getDate();
				if (day < 10) {
					day = "0" + day;
				}
				var data = year + "-" + mouth + "-" + day;
				if (row.ghDate == data) {
					return 'color:red;';
				}
			}
		});	
	 })	
		
</script>
	<!-- 门诊退费的选择挂号 -->
	<div class="easyui-layout" data-options="fit:true">
			<div data-options="region:'north',height:'45px',split:true,panelHeight:'auto'"
				style="width: 100px; padding: 5px; padding-left: 380px;">
	
				<input id="" class="easyui-searchbox"
					data-options="border: false, menu: '#mm', width: 220, prompt: '请输入你要查询的内容'" />
					
					<a id="cy_icon-mztfco" class="easyui-linkbutton"
					data-options="iconCls:'icon-add',width: '80px'">删除</a>
					<a id="cybtn-new" class="easyui-linkbutton"
					data-options="iconCls:'icon-add',width: '80px'">确定</a>
			</div>
	
			<div data-options="region:'center'" style="">
					<table id="cy_gh_mztf" class="easyui-datagrid"
							data-options="
										url:'queryChooseRegister',
										fitColumns:true,
										fit:true,
										pagination: true,
										width:'100%',
										pageSize: 5,
										pageList: [5, 10, 15, 20],
										rownumbers: true,					
									    border: false
										">
									<thead>
										<tr>				
											<th data-options="field:'ghNo',width:'20%'">门诊号</th>
											<th data-options="field:'ksName',width:'15%'">科室</th>
											<th data-options="field:'brName',width:'15%'">病人姓名</th>	
											<th data-options="field:'ghType',width:'18%'">挂号类型</th>	
											<th data-options="field:'ygName',width:'15%'">经办人</th>	
											<th data-options="field:'ghDate',width:'20%'">挂号日期</th>							
										</tr>
								</thead>
						</table>
					</div>			
			<div id="mm" style="width: 120px">
				<div data-options="name:'name'"></div>
			</div>
</body>
</html>